// 请求响应参数（不包含data）
export interface Result {
  code: string;
  msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数
export interface ResPage<T> {
  list: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}

// 分页请求参数
export interface ReqPage {
  pageNum: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    FUsername: string;
    FPassword: string;
    Fdevice?: string;
  }

  export interface ResLogin {
    access_token: string;
    refresh_token: string;
    tokenId: string;
    FName: string;
    FUserId: string;
  }

  export interface ResAuthButtons {
    [key: string]: string[];
  }

  export interface ResCheckAuth {
    isLogin: boolean;
    userInfo?: {
      FUserId: string;
      FUsername: string;
      FAvatar?: string;
    };
    sessionInfo?: {
      device: string;
      loginTime: string;
    };
  }
}

// 用户模块
export namespace User {
  export interface ReqRegister {
    FUsername: string;
    FPassword: string;
    FName?: string;
    FEmail?: string;
  }

  export interface ResUserInfo {
    FUserId: string;
    FUsername: string;
    FName: string;
    FEmail?: string;
    FCreateTime: string;
  }

  export interface ReqForceLogout {
    userId: string;
    reason: string;
  }

  export interface ReqRefreshToken {
    refresh_token: string;
  }
  export interface ReqLoginout {
    userId: string;
    tokenId: string;
  }

  export interface ResRefreshToken {
    access_token: string;
    refresh_token: string;
    tokenId: string;
  }
}
